var flag = true;
        function checkItems(id, name) 
        {
            check = document.getElementById(id);
            arr = document.getElementsByName(name);
                if (flag == true) 
                {
                    for (i=0; i<arr.length;i++) {
                        arr[i].checked = true;              
                    }
                    flag = false;
                    return flag;    
                } 
                else
                {
                    for (i=0; i<arr.length;i++) {
                        arr[i].checked = false;             
                    }
                    flag = true;
                    return flag;                
                } 

		}